export default {
  data () {
    return {
      thead: [
        // {
        //   type: 'selection',
        //   minWidth: 60,
        //   fixed: 'left'
        // },
        {
          title: '应聘岗位',
          key: 'candidate_position_name',
          minWidth: 150
        },
        {
          title: '姓名',
          key: 'resume_member_name',
          minWidth: 100,
          render: (h, params) => {
            return h('span', {
              'class': 'hover-table',
              style: {
                color: '#188cc7',
                cursor: 'pointer'
              },
              on: {
                click: () => {
                  console.log(params.row.candidate_id)
                  this.$router.push({ name: 'resume-detail', query: {resumeId: params.row.id, positionName: params.row.candidate_position_name}})
                }
              }
            }, params.row.resume_member_name)
          }
        },
        {
          title: '电话',
          key: 'resume_member_tel',
          minWidth: 150
        },
        {
          title: '年龄',
          key: 'resume_age',
          minWidth: 80
        },
        {
          title: '性别',
          key: 'resume_member_sex',
          minWidth: 80,
          render: (h, params) => {
            let row = params.row
            let arr = this.getStatusFn('SexType')
            console.log(arr)
            let text = arr.map((item) => {
              console.log(item.id)
              console.log(row.resume_member_sex)
              if (item.id === row.resume_member_sex) {
                return item.e_name
              }
            })
            console.log(text)
            return h('span', text)
          }
        },
        {
          title: '学历',
          key: 'resume_education',
          minWidth: 80,
          render: (h, params) => {
            let row = params.row
            let str = this.educationArr[row.resume_education]
            return h('span', str)
          }
        },
        {
          title: '工作经验',
          key: 'resume_work_age',
          minWidth: 150,
          render: (h, params) => {
            let row = params.row
            let str = this.workAgeArr[row.resume_work_age]
            
            return h('span', str)
          }
        },
        {
          title: '所在地区',
          key: 'resume_live_address',
          minWidth: 150,
          render: (h, params) => {
            let row = params.row
            let str = ''
            if (row.resume_live_address) {
              if (row.resume_live_address.match(/^[ ]+$/)) {
                str = '未填写'
              } else {
                str = row.resume_live_address
              }
            } else {
              str = '未填写'
            }
            return h('span', str)
          }
        }
      ],
      educationArr: ['小学', '初中', '高中', '中专', '大专', '本科', '硕士'],
      workAgeArr: ['无经验', '1年以下', '1年', '2年', '3年', '4年', '5年-10年', '10年-20年', '20年以上']
    }
  },
  methods: {
    // 获取分享招聘各种状态
    getStatusFn (encode) {
      let allStatus = JSON.parse(localStorage.getItem('FXZP_STATUS'))
      // console.log(allStatus)
      let statusArr = allStatus.filter((item) => {
        return item.e_encode === encode
      })
      return statusArr 
    }
  }
}
